From b904d4e6245acc781dfcca4c79b6efffce828aae Mon Sep 17 00:00:00 2001 From: "robertlipe@gmail.com" Date: Sat, 31 Dec 2011 16:15:07 +0000 Subject: [PATCH] C89 for MSVC which can't be bothered with that newfangled C99... git-svn-id: http://gpsbabel.googlecode.com/svn/trunk@4137 f51c46e8-681c-474f-0cfe-069cfd0219fb --- gpsbabel/bend.c | 13 ++++++++----- gpsbabel/cet/ansi_x3_4_1968.h | 4 ++-- gpsbabel/cet/ibm891.h | 6 +++--- gpsbabel/cet/ibm903.h | 6 +++--- gpsbabel/cet/iso_8859_1.h | 4 ++-- gpsbabel/kml.c | 17 ++++++++++------- gpsbabel/mmo.c | 2 +- 7 files changed, 29 insertions(+), 23 deletions(-) diff --git a/gpsbabel/bend.c b/gpsbabel/bend.c index 263b7ea80..78610fc56 100644 --- a/gpsbabel/bend.c +++ b/gpsbabel/bend.c @@ -76,19 +76,21 @@ create_wpt_dest(const waypoint* wpt_orig, double lat_orig, { double distance = gcdist(lat_orig, long_orig, lat_orig_adj, long_orig_adj); + double frac; + double lat_dest; + double long_dest; + waypoint* wpt_dest = NULL; distance = radtometers(distance); if (distance <= maxDist) { return NULL; } - double frac = maxDist / distance; - double lat_dest; - double long_dest; + frac = maxDist / distance; linepart(lat_orig, long_orig, lat_orig_adj, long_orig_adj, frac, &lat_dest, &long_dest); - waypoint* wpt_dest = waypt_dupe(wpt_orig); + wpt_dest = waypt_dupe(wpt_orig); wpt_dest->latitude = DEG(lat_dest); wpt_dest->longitude = DEG(long_dest); @@ -136,6 +138,7 @@ process_route(const route_head* route_orig, route_head* route_dest) double lat_orig_next = RAD(wpt_orig_next->latitude); double long_orig_next = RAD(wpt_orig_next->longitude); + waypoint* wpt_dest_next = NULL; if (is_small_angle(lat_orig, long_orig, lat_orig_prev, long_orig_prev, lat_orig_next, long_orig_next)) { @@ -148,7 +151,7 @@ process_route(const route_head* route_orig, route_head* route_dest) route_add_wpt(route_dest, wpt_dest_prev); } - waypoint* wpt_dest_next = create_wpt_dest(wpt_orig, + wpt_dest_next = create_wpt_dest(wpt_orig, lat_orig, long_orig, lat_orig_next, long_orig_next); if (wpt_dest_next != NULL) { route_add_wpt(route_dest, wpt_dest_next); diff --git a/gpsbabel/cet/ansi_x3_4_1968.h b/gpsbabel/cet/ansi_x3_4_1968.h index 5ecb94bf1..4f2fa39ec 100644 --- a/gpsbabel/cet/ansi_x3_4_1968.h +++ b/gpsbabel/cet/ansi_x3_4_1968.h @@ -37,11 +37,11 @@ const char *cet_cs_alias_ansi_x3_4_1968[] = #define cet_ucs4_ofs_ansi_x3_4_1968 128 #define cet_ucs4_cnt_ansi_x3_4_1968 1 -const int cet_ucs4_map_ansi_x3_4_1968[cet_ucs4_cnt_ansi_x3_4_1968] = {}; +const int cet_ucs4_map_ansi_x3_4_1968[cet_ucs4_cnt_ansi_x3_4_1968] = {0}; #define cet_ucs4_to_ansi_x3_4_1968_ct 1 -const cet_ucs4_link_t cet_ucs4_to_ansi_x3_4_1968_links[cet_ucs4_to_ansi_x3_4_1968_ct] = {}; +const cet_ucs4_link_t cet_ucs4_to_ansi_x3_4_1968_links[cet_ucs4_to_ansi_x3_4_1968_ct] = {0}; // #define cet_ucs4_to_ansi_x3_4_1968_extra_ct 200 diff --git a/gpsbabel/cet/ibm891.h b/gpsbabel/cet/ibm891.h index 820e0439b..85132b473 100644 --- a/gpsbabel/cet/ibm891.h +++ b/gpsbabel/cet/ibm891.h @@ -34,15 +34,15 @@ const char *cet_cs_alias_ibm891[] = #define cet_ucs4_ofs_ibm891 128 #define cet_ucs4_cnt_ibm891 1 -const int cet_ucs4_map_ibm891[cet_ucs4_cnt_ibm891] = {}; +const int cet_ucs4_map_ibm891[cet_ucs4_cnt_ibm891] = {0}; #define cet_ucs4_to_ibm891_ct 1 -const cet_ucs4_link_t cet_ucs4_to_ibm891_links[cet_ucs4_to_ibm891_ct] = {}; +const cet_ucs4_link_t cet_ucs4_to_ibm891_links[cet_ucs4_to_ibm891_ct] = {0}; /* #define cet_ucs4_to_ibm891_extra_ct 0 -const cet_ucs4_link_t cet_ucs4_to_ibm891_extra[cet_ucs4_to_ibm891_extra_ct] = {}; +const cet_ucs4_link_t cet_ucs4_to_ibm891_extra[cet_ucs4_to_ibm891_extra_ct] = {0}; */ cet_cs_vec_t cet_cs_vec_ibm891 = /* defined in cet.h */ diff --git a/gpsbabel/cet/ibm903.h b/gpsbabel/cet/ibm903.h index c7711cdd8..eeadd40a9 100644 --- a/gpsbabel/cet/ibm903.h +++ b/gpsbabel/cet/ibm903.h @@ -34,15 +34,15 @@ const char *cet_cs_alias_ibm903[] = #define cet_ucs4_ofs_ibm903 128 #define cet_ucs4_cnt_ibm903 1 -const int cet_ucs4_map_ibm903[cet_ucs4_cnt_ibm903] = {}; +const int cet_ucs4_map_ibm903[cet_ucs4_cnt_ibm903] = {0}; #define cet_ucs4_to_ibm903_ct 1 -const cet_ucs4_link_t cet_ucs4_to_ibm903_links[cet_ucs4_to_ibm903_ct] = {}; +const cet_ucs4_link_t cet_ucs4_to_ibm903_links[cet_ucs4_to_ibm903_ct] = {0}; /* #define cet_ucs4_to_ibm903_extra_ct 0 -const cet_ucs4_link_t cet_ucs4_to_ibm903_extra[cet_ucs4_to_ibm903_extra_ct] = {}; +const cet_ucs4_link_t cet_ucs4_to_ibm903_extra[cet_ucs4_to_ibm903_extra_ct] = {0}; */ cet_cs_vec_t cet_cs_vec_ibm903 = /* defined in cet.h */ diff --git a/gpsbabel/cet/iso_8859_1.h b/gpsbabel/cet/iso_8859_1.h index 092b69513..fd2376961 100644 --- a/gpsbabel/cet/iso_8859_1.h +++ b/gpsbabel/cet/iso_8859_1.h @@ -37,11 +37,11 @@ const char *cet_cs_alias_iso_8859_1[] = #define cet_ucs4_ofs_iso_8859_1 256 #define cet_ucs4_cnt_iso_8859_1 1 -const int cet_ucs4_map_iso_8859_1[cet_ucs4_cnt_iso_8859_1] = {}; +const int cet_ucs4_map_iso_8859_1[cet_ucs4_cnt_iso_8859_1] = {0}; #define cet_ucs4_to_iso_8859_1_ct 1 -const cet_ucs4_link_t cet_ucs4_to_iso_8859_1_links[cet_ucs4_to_iso_8859_1_ct] = {}; +const cet_ucs4_link_t cet_ucs4_to_iso_8859_1_links[cet_ucs4_to_iso_8859_1_ct] = {0}; /* #define cet_ucs4_to_iso_8859_1_extra_ct 0 diff --git a/gpsbabel/kml.c b/gpsbabel/kml.c index 874a7cf67..ccd023c09 100644 --- a/gpsbabel/kml.c +++ b/gpsbabel/kml.c @@ -1036,7 +1036,7 @@ const char* map_templates[] = { static void kml_gc_make_balloonstyletext(void) { - + const char** tp; kml_write_xml(1, "\n"); @@ -1080,7 +1080,6 @@ void kml_gc_make_balloonstyletext(void) kml_gc_all_tabs_text(); kml_write_xml(0, "

Extra Maps

\n"); - const char** tp; kml_write_xml(1, "
    \n"); // Fortunately, all the mappy map URLs take lat/longs in the URLs, so // the substition is easy. @@ -1263,13 +1262,15 @@ char* kml_geocache_get_logs(const waypoint* wpt) char* r = xstrdup(""); fs_xml* fs_gpx = (fs_xml*)fs_chain_find(wpt->fs, FS_GPX); + xml_tag* root = NULL; + xml_tag* curlog = NULL; + xml_tag* logpart = NULL; + if (!fs_gpx) { return r; } - xml_tag* root = fs_gpx->tag; - xml_tag* curlog = NULL; - xml_tag* logpart = NULL; + root = fs_gpx->tag; curlog = xml_findfirst(root, "groundspeak:log"); while (curlog) { time_t logtime = 0; @@ -1340,6 +1341,9 @@ static void kml_geocache_pr(const waypoint* waypointp) char* p, *is; char date_placed[100]; // Always long engough for a date. + const char* issues = ""; + char* logs; + kml_write_xml(1, "\n"); kml_write_xml(1, "\n"); @@ -1395,7 +1399,6 @@ static void kml_geocache_pr(const waypoint* waypointp) // Highlight any issues with the cache, such as temp unavail // or archived. - const char* issues = ""; if (waypointp->gc_data->is_archived == status_true) { issues = "<font color=\"red\">This cache has been archived.</font><br/>\n"; } else if (waypointp->gc_data->is_available == status_false) { @@ -1410,7 +1413,7 @@ static void kml_geocache_pr(const waypoint* waypointp) kml_write_xml(0, "%s\n", is); kml_write_xml(0, "\n", waypointp->gc_data->desc_short.utfstring ? waypointp->gc_data->desc_short.utfstring : ""); kml_write_xml(0, "\n", waypointp->gc_data->desc_long.utfstring ? waypointp->gc_data->desc_long.utfstring : ""); - char* logs = kml_geocache_get_logs(waypointp); + logs = kml_geocache_get_logs(waypointp); kml_write_xml(0, "\n", logs); xfree(logs); diff --git a/gpsbabel/mmo.c b/gpsbabel/mmo.c index 58f9843b4..979e3c24c 100644 --- a/gpsbabel/mmo.c +++ b/gpsbabel/mmo.c @@ -188,9 +188,9 @@ mmo_readstr(void) int ii, jj, ch, resbytes=0; res = xmalloc(len*2 + 1); // bigger to allow for utf-8 expansion for (ii=0; ii